package com.nebula.common.datasource.mybatis.pager;

import java.util.List;

public class DataPager<T> {
	private List<T> dataList; // 当页记录
	private long page = 1l; // 页号
	private long size = 20l;// 每页记录数
	private long totalPage = 0l; //总页数
	private long totalSize = 0l; // 总记录数
	public DataPager() {

	}
	public DataPager(Pager pager) {
		this.page = pager.getPage();
		this.size = pager.getSize();
	}

/*	public DataPager(DataPager dp, List<T> dataList) {
		this.dataList=dataList;
		this.page = dp.getPage();
		this.size = dp.getSize();
		this.total = dp.getTotal();
	}
	public static <T> DataPager<T> getDataPager(DataPager<T> dataPager, Pager pager) {
		return getDataPager(dataPager, pager.getPage());
	}

	public static <T> DataPager<T> getDataPager(DataPager<T> dataPager, int page) {
		Page<T> mpage = (Page<T>) dataPager.getDataList();
		if (dataPager.getDataList() != null && dataPager.getDataList().size() > 0 & mpage.getPages() < page) {
			dataPager.setDataList(new ArrayList<T>());
		}
		return dataPager;
	}*/

	public List<T> getDataList() {
		return dataList;
	}

	public void setDataList(List<T> dataList) {
		this.dataList = dataList;
	}

	public long getPage() {
		return page;
	}

	public void setPage(long page) {
		this.page = page;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public long getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(long totalPage) {
		this.totalPage = totalPage;
	}

	public long getTotalSize() {
		return totalSize;
	}

	public void setTotalSize(long totalSize) {
		this.totalSize = totalSize;
	}
}
